<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>有奖答题平台</title>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <link rel="stylesheet" href="/lib/mobile/css/common.css?0000"/>
    <link rel="stylesheet" href="/lib/mobile/css/center.css?0000"/>
    <link rel="stylesheet" href="/lib/mobile/css/index.css?111"/>
    <style>
        .login_button{
            font-size: 16px;
            height: 40px;
            line-height: 40px;
            border-radius: 4px;
            border: 1px solid #ddd;
            text-align: center;
            margin: 24px 0;
        }
    </style>
</head>
<body>
<div class="center">
    <div class="center_header" id="nickname"></div>
    <div class="center_user">
        <ul class="user_list">
            <li class="score"><h2 id="score"></h2><h4>本月积分</h4></li>
            <li class="rank"><h2 id="rank"></h2><h4>本月排名</h4></li>
        </ul>
        <div class="user_header"><img src="/lib/mobile/img/uhead.png?111" alt=""/></div>
    </div>
    <div class="center_form">
        <ul>
            <li><span>姓名</span><em id="name"></em></li>
            <li><span>单位</span><em id="dept"></em></li>
            <li><span>手机号</span><em id="phone"></em></li>
        </ul>
        <div class="login_button" id="moduser">修改</div>
    </div>
    <ul class="center_bottom">
        <li id="review"><a href="javascript:void(0)">答题记录</a></li>
        <li>|</li>
        <li id="point"><a href="javascript:void(0)">我的积分</a></li>
        <li>|</li>
        <li id="property"><a href="javascript:void(0)">我的财产</a></li>
        <li>|</li>
        <li id="coupon"><a href="javascript:void(0)">兑换礼品</a></li>
    </ul>
    <ul class="bottom_menu">
        <li  id="indexsy"><a href="javascript:void(0);">首页</a></li>
        <!--<li>|</li>-->
        <li  id="hdrule"><a href="javascript:void(0);">活动规则</a></li>
        <!--<li  id="point_rule"><a href="javascript:void(0);">积分规则</a></li>-->
        <!--<li>|</li>-->
        <!--<li id="prize_rule"><a href="javascript:void(0);">抽奖规则</a></li>-->
        <!--<li>|</li>-->
        <li id="center"><a href="javascript:void(0);">个人中心</a></li>
    </ul>
    <div class="copyright">版权所有：天时集团能源有限公司</div>
</div>
<script src="/lib/mobile/js/zepto.js"></script>
<script src="/lib/mobile/js/plugins/fastclick.js"></script>
<script src="/lib/mobile/js/bui.js"></script>
<script src="/lib/mobile/js/common.js?7777    "></script>
<script>
    bui.ready(function () {
        // 这里写业务及控件初始化
        var storage = bui.storage();
        bui.btn({id: ".bui-page", handle: ".bui-btn"}).load();
        var pageview = {};
        pageview.init = function () {
            // 验证码示例
            $("#moduser").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/moduser"});
            });
            $("#review").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/review"});
            });
            $("#coupon").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/coupon"});
            });
            $("#property").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/property"});
            });
            $("#point").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/point"});
            });
            $("#indexsy").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/index"});
            });
            $("#point_rule").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/point_rule"});
            });
            $("#prize_rule").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/prize_rule"});
            });
            $("#center").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/center"});
            });
            var uid=storage.get("uid");
            var user=storage.get("user");
            // console.log(user);
            var xm=storage.get("xm");
            var phone=storage.get("phone");
            var dept3=user[0].dept1;
            var dept4 = user[0].dept2;
            var dept;
            if(dept4!=''){
                dept=dept3+"-->"+dept4;
            }else{
                dept=dept3;
            }
            $("#phone").html(phone[0]);
            $("#name").html(user[0].xm);
            $("#dept").html(dept);
            //我的积分
            // console.log(uid[0]);
            getMyponit(uid[0]);
        }
        pageview.init();
    })

    function getMyponit(uid) {
        //执行登录操作
        var loginAjax = bui.ajax({
            url: BASE_URL+"mobile/myPersonPoint",
            // 可选参数
            data: {
                page:1,
                pageSize:1,
                uid:uid,
                ny:'',
                flag:'month'
            },
            method: "POST"
        });
        loginAjax.then(function(res) {
            if(res.code == 0){
                var user = res.data;
                if(user.length>0){
                    // console.log(user[0]);
                    var dept3 = user[0].dept3;
                    var dept4 = user[0].dept4;
                    var dept;
                    if(dept4!=''){
                        dept=dept3+"-->"+dept4;
                    }else{
                        dept=dept3;
                    }
                    // $("#phone").html(user[0].phone);
                    $("#rank").html(user[0].rankpx);
                    // $("#name").html(user[0].name);
                    $("#score").html(user[0].point);
                    // $("#dept").html(dept);
                    $("#nickname").html(user[0].usrname);
                }else{
                    $("#mypoint").html("");
                    $("#myrank").html("");
                }
            }else{
                bui.alert(res.msg);
            }
        },function(res) {
            bui.alert("请求异常");
        })
    }
</script>
</body>
</html>
